# Maintainer: Johannes Löthberg <johannes@kyriasis.com>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: helios
# Contributor: Lothar Gesslein
# Contributor: Dominik George <nik@naturalnet.de>

pkgname=tinc
pkgver=1.0.36
pkgrel=3

pkgdesc="VPN (Virtual Private Network) daemon"
url="https://www.tinc-vpn.org/"
arch=('loong64' 'x86_64')
license=('GPL')

depends=('lzo' 'openssl' 'zlib')

source=(https://www.tinc-vpn.org/packages/tinc-$pkgver.tar.gz{,.sig})

md5sums=('535b58ee026ec9551954dcc6ed56edca'
         'SKIP')
sha256sums=('40f73bb3facc480effe0e771442a706ff0488edea7a5f2505d4ccb2aa8163108'
            'SKIP')
validpgpkeys=('D62BDD168EFBE48BC60E8E234A6084B9C0D71F4A')

build() {
  cd tinc-$pkgver

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --sbindir=/usr/bin \
    --with-systemd=/usr/lib/systemd/system
  make
}

package() {
  cd tinc-$pkgver

  make DESTDIR="$pkgdir/" install
  install -dm755 "$pkgdir"/usr/share/tinc/examples
  cp -a doc/sample-config/. "$pkgdir"/usr/share/tinc/examples/
  find "$pkgdir"/usr/share/tinc/examples -type f -exec chmod 644 {} +
  find "$pkgdir"/usr/share/tinc/examples -type d -exec chmod 755 {} +
}
